﻿QuotingToolApp.controller('NewQuoteParamsController', ['$scope', '$uibModalInstance', 'CommonServices', function ($scope, $uibModalInstance, CommonServices) {

    //initalize data
    $scope.selectOptions = {
        CURRENCY_CODE: []
    };
    $scope.showError = false;
    $scope.showWarning = false;
    $scope.message = "";
    
    CommonServices.getCurrencies()
               .$promise
               .then(function (results) {
                   $scope.selectOptions.CURRENCY_CODE = results;
               })
               .catch(function (response) {
                   $scope.showError = true;
                   $scope.message = "Currency load failed";
               }
           );       

    $scope.ok = function () {
        $uibModalInstance.close($scope.CURRENCY_CODE);
    };

    $scope.cancel = function () {
        $uibModalInstance.dismiss('cancel');
    };

}]);